package com.zgw.mykotlin

/**
 * @project:MyKotlin
 * @author:zhuguowei
 * @time:2018/8/7 0007 16:03:00
 */
class Person {
    var name = ""
    var isMarried = false

    constructor(name: String, isMarried: Boolean) {
        this.name = name
        this.isMarried = isMarried
    }

}

enum class Color(val r: Int, val g: Int, val b: Int) { // 声明枚举常量的属性 zgw 2018/8/14 0014 11:49:48
    RED(255, 0, 0), ORANGE(255, 165, 0), YELLOW(255, 255, 0),
    GREEN(0, 255, 0), BLUE(0, 0, 255), INDIGO(75, 0, 130), VIOLET(238, 130, 238);// 这里必须有分号 zgw 2018/8/14 0014 11:52:59
    fun rgb() = (r * 256 + g) * 256 + b // 给枚举类定义一个方法 zgw 2018/8/14 0014 11:54:38
}

interface Expr
class Num(val value: Int) : Expr
class Sum(val left: Expr, val right: Expr) : Expr